<?php

namespace app\model;

use think\Model;

class OrderStatus extends Model
{

    protected $connection = 'mysql';

    protected $pk = 'id';

    protected $name = 'order_status';

    function getdatalist()
    {
        $ptypeArray = $this->find()
            ->asArray()
            ->all();

        return $ptypeArray;
    }

    public static function get_order_status_name_yuyue($id)
    {

        $ret = self::find($id);
        if (!empty($ret)) {
            return $ret->name_yuyue;
        }
    }

    public static function get_order_status_name($id)
    {

        $ret = self::find($id);
        if (!empty($ret)) {
            $ret = $ret->toArray();
            return $ret['name'];
        }
    }

    public static function getpcarray()
	{
		$data = self::field('id,name')->select()->toArray();

		$datalist = [];
		foreach ($data as $key => $vo) {
			$datalist[$key]['val'] = $vo['id'];
			$datalist[$key]['key'] = $vo['name'];
		}
		return $datalist;
	}
    public static function getallarray()
	{
		$data = self::field('id,name')->select()->toArray();
		$datalist = [];
		foreach ($data as $vo) {
			$datalist[$vo['id']] = $vo;

		}
		return $datalist;
	}
}
